// component/homelist.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    list:{
      type:Array,
      value:[],
    },
    type:{
      type: Number,
      value:0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    list:[],
    len:0,
    scrollTop:0,
    scrolltmp:0
  },
  /**
   * 组件的方法列表
   */
  methods: {
    toscroll(e){
      this.setData({
        scrolltmp: e.detail.scrollTop
      })
    },
    hideloading(isshow){
      var that = this;
      let top = 0;
      let delay = 0;
      if (isshow) {
        top = that.data.list.length * 50;
      } else {
        delay = 100;
        top = that.data.scrolltmp - 50;
      }
      setTimeout(function () {
        that.setData({
          scrollTop: top
        })
      }, delay);
    },
    tolower(e) {
      var myEventDetail = {} // detail对象，提供给事件监听函数
      var myEventOption = {} // 触发事件的选项
      this.triggerEvent('tolower', myEventDetail, myEventOption)
      this.hideloading(false);
    },
  }
})
